package com.example.demo.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import org.hibernate.validator.constraints.Range;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@Data
@Entity
public class Student {
//    @NotBlank(message = "姓名不能为空")
//    @Size(min=1 ,max=6)
    private String sname;

//    @NotBlank(message = "性别不能为空")
    private String sex;

    @Id
//    @NotNull
//    @Range(min = 0 , max = 20)
    private int sid;

//    @NotNull
//    @Digits(integer = 1, fraction = 0,message = "不能为空")
    private String grade;
    private String major;
    private String course;
    private String college;

    public String getSname() {
        return sname;
    }

    public void setSname(String sname) {
        this.sname = sname;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getSid() {
        return sid;
    }

    public void setSid(int sid) {
        this.sid = sid;
    }

    public String getGrade() {
        return grade;
    }

    public void setGrade(String grade) {
        this.grade = grade;
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    public String getCourse() {
        return course;
    }

    public void setCourse(String course) {
        this.course = course;
    }

    public String getCollege() {
        return college;
    }

    public void setCollege(String college) {
        this.college = college;
    }

    @Override
    public String toString() {
        return "Student{" +
                "sname='" + sname + '\'' +
                ", sex='" + sex + '\'' +
                ", sid=" + sid +
                ", grade='" + grade + '\'' +
                ", major='" + major + '\'' +
                ", course='" + course + '\'' +
                ", college='" + college + '\'' +
                '}';
    }
}
